/*
 * ThreadDriveController.h
 *
 *  Created on: Jan 26, 2013
 *      Author: Drew Prevost
 */

#ifndef THREADDRIVECONTROLLER_H_
#define THREADDRIVECONTROLLER_H_

#include <Protothread.h>
#include "Arduino.h"
#include "ThreadMotorController.h"
#include "ThreadServoRate.h"
#include "Tachometer.h"

class ThreadDriveController: public Protothread
{
public:
  ThreadDriveController(
                         int nTachPin,
                         int nTachIrqNum,
                         int nTachIsrPin,
                         int nTachIsrMode,
                         int nMotorPin,
                         int nServoPin,
                         unsigned long nServoMaxSpeedInMicrosPerDegree,
                         unsigned int nServoInitialPosition,
                         unsigned int nServoInitialRateInDegPerSec );
  virtual ~ThreadDriveController();

  virtual bool run();

protected:
  Tachometer & tachWheel;
  ThreadMotorController threadMotorDrive;
  ThreadServoRate threadServoClutch;
  ThreadMicroDelay threadMicroDelay;
};

#endif /* THREADDRIVECONTROLLER_H_ */
